package cn.edu.leetcode.单链表;

public class 单链表反转 {

    public static void main(String[] args) {

    }


    public static ListNode reverseList(ListNode head) {
        ListNode root = null, p;
        while (head != null) {
            p = head;
            head = head.next;

            p.next = root;
            root = p;
        }
        return root;
    }


}
